#ifndef PICCOLO_VK_BUFFER_H
#define PICCOLO_VK_BUFFER_H

#include "Graphics/PiccoloVKCommon.h"

namespace Piccolo
{
    class PiccoloVKDevice;

    class PiccoloVKBuffer
    {
    public:
        PiccoloVKBuffer(PiccoloVKDevice* device, VkBufferUsageFlags usage, size_t size, void* data = nullptr, bool hostViaible = false);
        ~PiccoloVKBuffer();

        VkBuffer GetBuffer() const { return mBuffer; }

        static void CopyBuffer(PiccoloVKDevice* device, VkBuffer srcBuffer, VkBuffer dstBuffer, size_t size);
        static void CreateBufferInternal(PiccoloVKDevice* device, VkMemoryPropertyFlags memProps, VkBufferUsageFlags usage, size_t size, VkBuffer* outBuffer, VkDeviceMemory* outMemory);

        VkResult WriteData(void* data);

    private:
        void CreateBuffer(VkBufferUsageFlags usage, void* data);

        VkBuffer mBuffer = VK_NULL_HANDLE;
        VkDeviceMemory mDeviceMemory = VK_NULL_HANDLE;

        PiccoloVKDevice* mDevice;
        size_t mSize;
        bool bHostViaible;
    };
}

#endif